Skip to content

Conversation

@mirao
Copy link
Contributor

@mirao mirao commented Jan 26, 2026

Summary

Fixes #5412 - run-workers --by suite parallelization was broken by PR #5386 which added test file sorting.

The Problem

When this.testFiles.sort() was added to loadTests(), it changed the order of test files before worker distribution. This caused the --by suite parallelization to break - all workers could receive the same tests instead of different suites being distributed to different workers.

The Fix

Move testFiles.sort() from loadTests() to run(). This ensures:

Changes

  1. lib/codecept.js: Moved this.testFiles.sort() from loadTests() to run()
  2. test/unit/alphabetical_order_test.js: Updated to verify sorting happens in run()
  3. test/unit/worker_test.js: Added test to verify files are NOT sorted after loadTests() (the key fix for Run-workers: Parallelization per suite doesn't work in specific case in 3.7.6 #5412)

Test Plan

  • All existing unit tests pass (499 passing)
  • All runner tests pass (247 passing)
  • New test verifies the fix: files are not sorted after loadTests()
  • New test fails when the fix is reverted (verified)

🤖 Generated with Claude Code

…ng (codeceptjs#5412)

The sorting of test files in loadTests() (added in codeceptjs#5386) broke the
--by suite parallelization. When files were sorted before worker
distribution, all workers could receive the same tests instead of
different suites being distributed to different workers.

Fix: Move testFiles.sort() from loadTests() to run(). This ensures:
- Worker distribution uses original (unsorted) file order for consistent
  distribution across workers
- Test execution still uses alphabetical order (sorted in run())

Added unit test to verify files are not sorted after loadTests().

Fixes codeceptjs#5412

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run-workers: Parallelization per suite doesn't work in specific case in 3.7.6

1 participant